package samples.d3.image 
{
	import com.bit101.components.CheckBox;
	import com.bit101.components.HUISlider;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BitmapDataChannel;
	import flash.events.Event;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import samples.BaseSample;
	
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class Layers extends BaseSample
	{
		
		[Embed(source = '../../../../lib/fruit1.jpg')]private var imageSrc:Class;
		private var image:Bitmap;
		
		
		private var tmp:BitmapData;
		private var bd:BitmapData;
		private var bmp:Bitmap;
		
		
		public function Layers() 
		{
			
			image = new imageSrc();
			var w:int = image.width;
			var h:int = image.height;
			
			tmp = image.bitmapData.clone();
			
			bd = new BitmapData( w * 2, h * 2, false, 0 );
			bmp = new Bitmap( bd );
			addChild( bmp );
			
			bd.copyChannel( tmp, tmp.rect, new Point( w, 0 ), BitmapDataChannel.RED, BitmapDataChannel.RED );
			bd.copyChannel( tmp, tmp.rect, new Point( 0, h ), BitmapDataChannel.GREEN, BitmapDataChannel.GREEN );
			bd.copyChannel( tmp, tmp.rect, new Point( w, h ), BitmapDataChannel.BLUE, BitmapDataChannel.BLUE );
			
			addChild( image );
			center();
			
		}
		
	}

}